<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

class system
{
    function message($title,$message,$linkurl,$link)
    {
        global $output,$STYLE,$db,$template;
        $tpl = $STYLE->open('message.tpl');
        $output .= $STYLE->tags($tpl,array("TITLE"=>$title, "MESSAGE"=>$message, "LINK" => $linkurl, "LINK-TEXT"=>$link));
        include("./inc/footer.php");
        exit;
    }

    function redirect($url)
    {
        echo '<meta http-equiv="refresh" content="1; URL='.$url.'">';
        unset($url);
        exit;
    }

    function confdata($value)
    {
        global $db,$prefix;
        $result = $db->fetch("SELECT value FROM ".$prefix."_confdata WHERE name = '$value'");
        return $result['value'];
        unset($result);
    }
}

class secure
{
    function clean($content)
    {
        $content = mysql_real_escape_string(strip_tags($content));
	return $content;
    }

    function verify_email ( $email ){
	global $prefix,$db;

	if (preg_match("/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i", $email)){
                $email_sql = $db->query("SELECT id FROM accounts WHERE email LIKE '$email'");

                if ( $email_sql ){
                    $check = "exist";
                } else{
                    $check = "true";
                }


	} else{
		$check = "false";
	}

	return $check;
}
}

?>
